/**********************************************************************************************************************
 *
 * Project:    mGameEngine
 * File:       fileloader.cpp
 * Author:     karooolek
 * Created on: 2009-03-22
 *
 **********************************************************************************************************************/

#include "fileloader.h"

namespace mGameEngine
{

FileLoader::FileLoader() : Loader(), _filename(), _extension()
{
}

FileLoader::FileLoader(const String &filename) : Loader()
{
    setFileName(filename);
}

FileLoader::~FileLoader()
{
}

void FileLoader::setFileName(const String &filename)
{
    _filename = filename;

    // extract path
    _path.clear();
    int pos = _filename.find_last_of("/\\");
    if(pos != -1)
    {
        _path = _filename.substr(0, pos + 1);
    }

    //extract extension
    _extension.clear();
    pos = _filename.find_last_of('.');
    if(pos != -1)
    {
        uint len = _filename.length() - pos - 1;
        _extension = _filename.substr(pos + 1, len);
    }
}

}

